﻿using System.Collections.Generic;
using Xamarin.Forms;

namespace Games.HuaRongDao
{
    class Cell : Image
    {
        static Cell()
        {
            for(int i = 0; i < 16; i++)
            {
                var img = ImageSource.FromFile($"hrd_{i}.png");
                images.Add(i, img);
            }
        }

        private static Dictionary<int, ImageSource> images = new Dictionary<int, ImageSource>();
        public Cell(int id)
        {
            this.ID = id;
            this.Aspect = Aspect.Fill;
        }

        public int ID { get; }
        public Block Block { get; private set; }
        public void SetBlock(Block block)
        {
            this.Block = block;
            this.Source = images[block.ImageId];
        }
    }
}
